import { Column, Entity, Index } from "typeorm";
import { BaseEntity } from "../../base/entity/base";

/**
 * 实体商品物流信息
 */
@Entity('order_logistics', { comment: '订单物流' })
export class OrderLogisticsEntity extends BaseEntity {
    @Index()
    @Column({ comment: '订单ID' })
    orderId: number;

    @Index()
    @Column({ comment: '订单子项ID' })
    itemId: number;

    @Column({ comment: '收货人姓名', length: 50 })
    receiverName: string;

    @Index()
    @Column({ comment: '收货人手机号', length: 20 })
    receiverPhone: string;

    @Column({ comment: '收货地址', type: 'json' })
    address: {
        province?: string;
        city?: string;
        district?: string;
        detail?: string;
    };

    @Column({ comment: '快递公司', length: 50, nullable: true })
    company: string;

    @Index()
    @Column({ comment: '快递单号', length: 100, nullable: true })
    trackingNo: string;
}


